#include<iostream>
#include<set>
using namespace std;
struct Point
{
	int x, y;
	bool operator<(const Point& a)const
	{
		if (x == a.x) {
			return y < a.y;
		}
		else {
			return x < a.x;
		}
	}
};
int main()
{
	int n;
	set<Point>arr;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		Point temp;
		cin >> temp.x >> temp.y;
		arr.insert(temp);
	}
	for (set<Point>::iterator it = arr.begin(); it != arr.end(); it++)
	{
		cout << it->x << " " << it->y << endl;
	}
	return 0;
}